<?php
require_once('./connexion.php');
require ('../func.req.php');
require('../config/tbl.php');

/*
  -----------------------------------
  ---- SCRIPT D'AUTHENTIFICATION ----
  FujiCraft V3.0
  By Fujido
  Contact : thefujido@gmail.com
  -----------------------------------
 */

@session_start(); // On relaye la session
if (@session_is_registered("authentification")) { // v�rification sur la session authentification (la session est elle enregistr�e ?)
// ici les �ventuelles actions en cas de r�ussite de la connexion
} else {
    header("Location:index.php?erreur=intru"); // redirection en cas d'echec
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title><?php echo $site; ?> | <?php echo $admin; ?> | Gestion des plugins</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="Content-Style-Type" content="text/css" />
        <meta http-equiv="content-language" content="fr,en" />
        <link rel='shortcut icon' type="image/x-icon" href='../images/favicon.ico' />
        <link rel="stylesheet" type="text/css" href="../css/style.css" title="" media="all" />
        <link rel="stylesheet" type="text/css" href="../css/register.css" title="" media="all" />
    </head>
    <body>
        <?php
// si l'utilisateur est connect� comme admin ...
        if ($_SESSION['privilege'] == "admin") { // Affichage conditionnel : si et seulement si l'utilisateur est connect� avec le privilege administrateur
            ?>
            <div id="block">
                <div id="contentblock">
                    <div class="wrapper">
                        <?php
                        show_header_adm();
                        show_menu_adm();
                        ?>
                        <div class="mainbox">
                            <h2>Gestion des plugins</h2>
                            <br />
                            <center>
                                <?php
                                if (isset($_POST['updateplugin'])) {
                                    $minequery = $_POST['minequery'];
                                    $datalog = $_POST['datalog'];
                                    $iconomy = $_POST['iconomy'];
                                    $jobs = $_POST['jobs'];
                                    $dynmap = $_POST['dynmap'];
                                    $dynmap_url = $_POST['dynmap_url'];

                                    $query = "UPDATE " . $database . "." . $tb_plugins . " SET datalog_plg = '$datalog', iconomy_plg = '$iconomy', jobs_plg = '$jobs', dynmap_plg = '$dynmap', dynmap_url_plg = '$dynmap_url', minequery_plg = '$minequery' ";
                                    mysql_query($query) OR DIE(mysql_error());
                                    ?>
                                    <div id="box" onclick="document.getElementById('box').style.display='none';" class="success-box rounded" title="Fermer la fen&ecirc;tre">
                                        Les informations ont bien &eacute;t&eacute; enregistr&eacute;es.
                                    </div>
                                    <br />
                                    <br />
                                    <a href="<?php echo $_SERVER['PHP_SELF']; ?>" class="btn">Retour &agrave; la gestion des Configurations</a> <br />
                                    <br />
                                    <br />
                                    <?php
                                } else {
                                    require('../config/tbl.php');
                                    ?>
                                    <h3>Informations</h3>
                                    Veuillez choisir entre "<b>Oui</b>" ou "<b>Non</b>" si vous possèdez ces plugins ou non. Cela affectera le panneau d'administration. <br />
                                    <br />
                                    <h3>Choix des plugins</h3>
                                    <br />
                                    <form method="post" action="">
                                        <table border="0" cellspacing="0">
                                            <tr>
                                                <td colspan="3" class="title_form">Plugins utilis&eacute;s</td>
                                            </tr>
                                            <tr>
                                                <td class="text_form"><a href="http://plugins.bukkit.org/#ti=minequery&ta=all&au=&subm=false&pno=0" title="T&eacute;l&eacute;charger Minequery">Minequery :</a> </td>
                                                <td>
                                                    <select name="minequery">
                                                        <option>Non</option>
                                                        <option>Oui</option>
                                                    </select>
                                                    <i class="px10">(Conseill&eacute;)</i>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="text_form"><a href="http://plugins.bukkit.org/#ti=datalog&ta=all&au=&subm=false" title="T&eacute;l&eacute;charger DataLog">DataLog :</a> </td>
                                                <td>
                                                    <select name="datalog">
                                                        <option>Non</option>
                                                        <option>Oui</option>
                                                    </select>
                                                    <i class="px10">(Conseill&eacute;)</i>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="text_form"><a href="http://plugins.bukkit.org/#ti=iconomy&ta=all&au=&subm=false" title="T&eacute;l&eacute;charger iConomy">iConomy :</a> </td>
                                                <td>
                                                    <select name="iconomy">
                                                        <option>Non</option>
                                                        <option>Oui</option>
                                                    </select>
                                            </tr>
                                            <tr>
                                                <td class="text_form"><a href="http://plugins.bukkit.org/#ti=jobs&ta=all&au=&subm=false" title="T&eacute;l&eacute;charger Jobs">Jobs :</a> </td>
                                                <td>
                                                    <select name="jobs">
                                                        <option>Non</option>
                                                        <option>Oui</option>
                                                    </select>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="text_form"><a href="http://plugins.bukkit.org/#ti=dynmap&ta=all&au=&subm=false" title="T&eacute;l&eacute;charger Dynmap">Dynmap :</a> </td>
                                                <td>
                                                    <select name="dynmap">
                                                        <option>Non</option>
                                                        <option>Oui</option>
                                                    </select>
                                                    <input type="text" name="dynmap_url" value="<?php echo $dynmap_url; ?>" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2" valign="middle" align="center"><input type="submit" name="updateplugin" value="&Eacute;diter" class="btn" /></td>
                                            </tr>
                                        </table>
                                        <br />
                                    </form>
                                </center>
                                <br />
                            </div>
                            <?php
                        }
                        show_footer_adm();
                        ?>
                    </div>
                </div>
            </div>
        <?php } ?> <!-- fin de l'affichage conditionnel -->
        <?php
// si l'utilisateur est connect� comme simple utilisateur ...
        if ($_SESSION['privilege'] == "user") { // Affichage conditionnel : si et seulement si l'utilisateur est connect&eacute; avec le privilege utilisateur simple
            header("Location:index.php?erreur=refused"); // redirection si c'est un utilisateur
        }
        ?>
    </body>
</html>
